package com.example.harmonyosdemo.activity;

import com.example.harmonyosdemo.ResourceTable;
import com.example.harmonyosdemo.base.BaseAbility;
import com.example.harmonyosdemo.utils.LogUtils;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Button;
import ohos.agp.components.Component;
import ohos.agp.components.Text;


public class MainAbility extends BaseAbility {
    public static String TAG = "MainAbility ypk ";

    Button btnJSQ,btnAbout;

    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);

        btnJSQ = findComponentById(ResourceTable.Id_btnJSQ);
        btnAbout = findComponentById(ResourceTable.Id_btnAbout);
        LogUtils.i(TAG, "onStart");

        initListener();

        // jump();

    }

    private void initListener() {
        btnJSQ.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                openActivity(JSQAbility.class);
            }
        });
        btnAbout.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                openActivity(AboutAbility.class);
            }
        });
    }

    private void jump() {
        LogUtils.i("TAG", "ypk");
        System.out.println("MainAbility.jump");
        LogUtils.i(TAG, "onStart111111111111111323433111111111111");
        String name = AboutAbility.class.getName();
        LogUtils.i(TAG, "name=" + name);

        String getCanonicalName = AboutAbility.class.getCanonicalName();
        LogUtils.i(TAG, "getCanonicalName=" + getCanonicalName);

        String getSimpleName = AboutAbility.class.getSimpleName();
        LogUtils.i(TAG, "getSimpleName=" + getSimpleName);

        // openActivity(AboutAbility.class);

    }

    @Override
    public void onActive() {
        super.onActive();
        LogUtils.i(TAG, "onActive");
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
        LogUtils.i(TAG, "onForeground");
    }


}
